package org.example.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.example.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 宋孟林
 * @description
 * @create: 2025/3/8 8:57
 */
@RestController
@Slf4j
@Api(tags = "订单接口")
public class OrderController {
    @Autowired
    private OrderService orderService;

    @PostMapping("/order/add")
    @ApiOperation("添加订单接口")
    public void addOrder(){
        orderService.addOrder();
    }

    @GetMapping("/order/getOrder/{keyId}")
    @ApiOperation("获取订单接口")
    public String getOrderById(@PathVariable Integer keyId){
        String value = orderService.getOrderById(keyId);
        log.info("订单是：{}", value);
        return value;
    }

}
